package com.ilink.groundservice.mapper.Literature;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ilink.groundservice.entity.PO.Literature.AiXLiteratureFavorite;
import com.ilink.groundservice.entity.VO.AiX.AiXLiteratureResponse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

@Mapper
public interface AiXLiteratureFavoriteMapper extends BaseMapper<AiXLiteratureFavorite> {

    /**
     * 分页查询用户收藏的文献
     */
    IPage<AiXLiteratureResponse> selectFavoriteLiteratures(Page<AiXLiteratureResponse> page, @Param("userId") String userId);

    /**
     * 检查用户是否已收藏文献
     */
    AiXLiteratureFavorite selectByUserIdAndLiteratureId(@Param("userId") String userId, @Param("literatureId") Long literatureId);

    /**
     * 删除用户对文献的收藏
     */
    int deleteByUserIdAndLiteratureId(@Param("userId") String userId, @Param("literatureId") Long literatureId);
} 